package com.kymatrix.mpo.plus.bpm.server.dao.definition;

import com.kymatrix.mpo.plus.bpm.server.config.mybatis.mapper.BaseMapperX;
import com.kymatrix.mpo.plus.bpm.server.config.mybatis.query.LambdaQueryWrapperX;
import com.kymatrix.mpo.plus.bpm.server.model.entity.definition.BpmProcessListenerEntity;
import com.kymatrix.mpo.plus.bpm.server.model.form.listener.PageQueryBpmProcessListenerReq;
import com.kymatrix.mpo.plus.common.business.common.PageResp;
import org.apache.ibatis.annotations.Mapper;

/**
 * BPM 流程监听器 Mapper
 *
 */
@Mapper
public interface BpmProcessListenerMapper extends BaseMapperX<BpmProcessListenerEntity> {

    default PageResp<BpmProcessListenerEntity> selectPage(PageQueryBpmProcessListenerReq reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BpmProcessListenerEntity>()
                .likeIfPresent(BpmProcessListenerEntity::getName, reqVO.getName())
                .eqIfPresent(BpmProcessListenerEntity::getType, reqVO.getType())
                .eqIfPresent(BpmProcessListenerEntity::getEvent, reqVO.getEvent())
                .eqIfPresent(BpmProcessListenerEntity::getStatus, reqVO.getStatus())
                .orderByDesc(BpmProcessListenerEntity::getId));
    }

}
